Skip to content

Plugin/TagFix_Maxspeed_AT #2506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: dev
Choose a base branch
from

Conversation

wolfbert
Copy link
Contributor

@wolfbert wolfbert commented May 8, 2025

The plugin contains a number of tests focusing on maxspeed, maxspeed:type and source:maxspeed specific to Austria. It is by no means complete, but will do until further community decisions have been taken.

I've tested the logic locally, but have no Osmose dev environment. I need ids for 6 issue classes (currently numbered 1 to 6) and integration support. Test cases are provided, but have never run (I used a local test harness to feed data). I'd like to provide a German translation following successful integration.

#2503

'''A speed limit type is given in `maxspeed:type` or `source:maxspeed`, but no speed limit is set in `maxspeed`.'''),
fix=T_(
'''Set `maxspeed` and `maxspeed:type` or `source:maxspeed` (but not both) as appropriate.
For a list of values, see table 'valid_maxspeed_types' in the source code below.'''),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the average user can read Python code. You can probably print it to the user if you wish, T_(...) can have a second argument with placeholder contents (T('abc {0}', 'AT:motorway') gives 'abc AT:motorway', where abc is translated and AT:motorway is not. Even better, point to the wiki.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the time there was no reliable information in the wiki. Meanwhile I've updated the wiki and will link to it.

title=T_('Multiple speed limit types'),
detail=T_(
'''`maxspeed:type` and `source:maxspeed` are both set. This may cause confusion for mappers and data consumers,
especially if the values are different.'''),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what's wrong with maxspeed:type=AT:* + source:maxspeed=survey (or maybe survey;AT:*)
Also, if they are different and are linked to different values (say 130 and 50), "may cause confusion" is probably quite an understatement, while if the values are identical, it's at most redundant, not bad, is it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If maxspeed:type is set, it must be a valid speed type, and source:maxspeed can be anything except a speed type different from maxspeed:type (the code handles this).

If only source:maxspeed is set, things are more difficult. Out of 130.000 values, less than 50 are true comments (and many of those indicate situations to be resolved). So far, these would have been reported. I've changed the code to only report clearly invalid speed types. This will miss a couple of cases (e.g. values spearated with ;), but that's ok.

detail=T_(
'''The speed limit in `maxspeed` is not consistent with the speed limit type in `maxspeed:type` or `source:maxspeed`.'''),
fix=T_(
'''Set `maxspeed` and/or `maxspeed:type`/`source:maxspeed` (but not both) as appropriate. For a list of values,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'''Set `maxspeed` and/or `maxspeed:type`/`source:maxspeed` (but not both) as appropriate. For a list of values,
'''Set either `maxspeed:type` or `source:maxspeed` (but not both), and `maxspeed`, as appropriate. For a list of values,

Just to make sure it's 100% clear that the "(but not both)" does not refer to maxspeed in any situation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworded

# Error: maxspeed type without maxspeed
if not maxspeed:
if maxspeed_type or source_maxspeed:
err.append({'class': 1, 'text': T_('Speed limit type without maxspeed')})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why nearly duplicate the title in text? Just make the title say maxspeed and remove the text, or make the text reflect the actual tag values (maxspeed:type or source:maxspeed) involved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworded to output speed limit type.

# Error: maxspeed suspiciously low, probably 'walk'; needs verification
if maxspeed.isdigit():
maxspeed_num = int(maxspeed)
if maxspeed_num < 10:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that < 5 is already covered by plugin Numeric.py

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to exclude values < 5; expanded to cover values < 15 (which is the lowest possible zone) which are not explicitly signposted.

# Error: maxspeed type doesn't match maxspeed
# except for types covered in TagFix_Maxspeed plugin and types without specific speed
if valid_type and valid_type not in {'AT:motorway', 'AT:trunk', 'AT:rural', 'AT:urban', 'sign', 'AT:zone', 'zone'}:
if maxspeed != self.valid_maxspeed_types.get(valid_type):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than hardcoding the ones you set to '', you could consider checking if self.valid_maxspeed_types.get(valid_type) has a value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.

'source:maxspeed': 'read it in the news'}, None)

# Error when maxspeed type without maxspeed
assert self.check_err(plugin.way(None, {'highway': 'secondary', 'maxspeed:type': 'sign'}, None))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.check_err doesn't need an assert

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Famlam
Copy link
Collaborator

Famlam commented Jun 1, 2025

Your comments suggest code changes have been made but I don't see them here yet, possibly you forgot to push them live?

@wolfbert
Copy link
Contributor Author

wolfbert commented Jun 2, 2025

I comment as I fix the problems, but push after final testing. Should be ready later today. Thanks for the detailed review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants